package com.zm.spring.demo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component("personAuto")
public class Person {
    private String name;
    private Integer age;
    private String gender;
    public List<String> likes;
    public Person mather;
    public Person father;

    public Person() {
        System.out.println("^^^^^^^0^^^^^^^^^^"+this);
        System.out.println("---------------- 0 -----------------");
    }

    public Person(String name, Integer age) {
        System.out.println("^^^^^^^^^1^^^^^^^^"+this);
        System.out.println("---------------- 1 -----------------");
        this.name = name;
        this.age = age;
    }

    public Person(String name, String gender) {
        System.out.println("^^^^^^^^^2^^^^^^^^"+this);
        System.out.println("---------------- 2 -----------------");
        this.name = name;
        this.gender = gender;
    }

    public Person(String name, Integer age, String gender) {
        System.out.println("^^^^^^^^^3^^^^^^^^"+this);
        System.out.println("---------------- 3 -----------------");
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public void hello(){
        System.out.println("helllo:"+this.name);
    }

    public Person create(){
        return new Person("王五",20);
    }

    public static Person staticCreate(){
        return new Person("赵六","男");
    }

    void init(){
        System.out.println(this);
        System.out.println("对象创建完成");
    }

    void destroy(){
        System.out.println(this);
        System.out.println("对象销毁完成");
    }
}
